﻿package mortal.game.view.copy.QuestionCopy.data
{
    import Message.Public.*;
    import com.gengine.core.frame.*;
    import flash.utils.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class QuestionCopyCache extends Object
    {
        public var appBeginTime:uint = 0;
        public var openS:SQuestionOpen;
        public var curQuesInfo:SQuestionMsg;
        public var playInfo:SQuestionPlayerMsg;
        public var isOverFlag:Boolean = false;
        public var useTimeProType:Array;
        public var hasUseTime:Array;
        public var hasAutoOpenEnter:Boolean = false;
        public var curPosValue:int;
        public var passInfo:SQuestionCloseMsg;
        private var _getMsgTime:uint;
        private var _timeC:SecTimer;

        public function QuestionCopyCache()
        {
            this.useTimeProType = [0, -1];
            this.hasUseTime = [0, -1];
            return;
        }// end function

        public function questionOpen(param1:SQuestionOpen) : void
        {
            this.openS = param1;
            this.isOverFlag = false;
            return;
        }// end function

        public function qestionSyn(param1:SQuestionMsg) : void
        {
            if (this._timeC)
            {
                this._timeC.stop();
            }
            this.curQuesInfo = param1;
            this.hasUseTime = [0, -1];
            this._getMsgTime = getTimer();
            if (this._timeC == null)
            {
                this._timeC = new SecTimer();
                this._timeC.addListener(TimerType.ENTERFRAME, this.onEnterTime);
            }
            if (this.curQuesInfo.surplusSeconds > 0)
            {
                this._timeC.start();
            }
            else
            {
                this._timeC.stop();
            }
            return;
        }// end function

        public function getShowTime() : int
        {
            return this.curQuesInfo.surplusSeconds;
        }// end function

        private function onEnterTime(param1:Object) : void
        {
            var _loc_2:* = this.curQuesInfo;
            var _loc_3:* = this.curQuesInfo.surplusSeconds - 1;
            _loc_2.surplusSeconds = _loc_3;
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyQuestioCountDown));
            if (this.curQuesInfo.surplusSeconds < 0)
            {
                this._timeC.stop();
            }
            return;
        }// end function

        public function questionEnd() : void
        {
            if (this._timeC)
            {
                this._timeC.stop();
                this._timeC = null;
            }
            return;
        }// end function

        public function updatePlayInfo(param1:SQuestionPlayerMsg) : void
        {
            this.playInfo = param1;
            return;
        }// end function

        public function updateStatus(param1:int) : void
        {
            if (this.curQuesInfo)
            {
                this.curQuesInfo.status = param1;
            }
            return;
        }// end function

    }
}
